package com.maimao.model.user.sys;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author MaoLin Wang
 * @date 2020/11/28 11:14 上午
 */
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_role")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Role implements Serializable {

    private static final long serialVersionUID = -5540378850448446432L;
    @TableId(type = IdType.AUTO)
    private Integer id;

    @NotBlank(message = "请填写角色编码")
    @TableField(value = "role_code")
    private String roleCode;

    @NotBlank(message = "请填写角色名")
    @TableField(value = "role_name")
    private String roleName;

    @TableField(value = "`desc`")
    private String desc;

    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @TableField(value = "update_user")
    private Integer updateUser;

    @TableField(value = "create_user")
    private Integer createUser;

    @TableLogic(delval = "0",value = "1")
    @TableField(value = "`status`")
    private Integer status;

    /**
     * 1 系统角色 2前端角色
     */
    @NotNull(message ="请选择角色类型")
    @TableField(value = "sys_role")
    private Integer sysRole;

    @Override
    public String toString() {
        return "Role{" +
                "id=" + id +
                ", roleCode='" + roleCode + '\'' +
                ", roleName='" + roleName + '\'' +
                ", desc='" + desc + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", updateUser=" + updateUser +
                ", createUser=" + createUser +
                ", status=" + status +
                ", sysRole=" + sysRole +
                '}';
    }
}
